home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / CIncludes / GXEnvironment.h < prev    next >
C/C++ Source or Header  |  1996-05-01  |  10KB  |  297 lines

  1. /*
  2.      File:        GXEnvironment.h
  3.  
  4.      Contains:    QuickDraw GX environment constants and interfaces
  5.  
  6.      Version:    Technology:    Quickdraw GX 1.1
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __GXENVIRONMENT__
  19. #define __GXENVIRONMENT__
  20.  
  21. #ifndef __CONDITIONALMACROS__
  22. #include <ConditionalMacros.h>
  23. #endif
  24. #ifndef __MIXEDMODE__
  25. #include <MixedMode.h>
  26. #endif
  27. #ifndef __WINDOWS__
  28. #include <Windows.h>
  29. #endif
  30. #ifndef __GXTYPES__
  31. #include <GXTypes.h>
  32. #endif
  33. #ifndef __CMAPPLICATION__
  34. #include <CMApplication.h>
  35. #endif
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40.  
  41. #if PRAGMA_IMPORT_SUPPORTED
  42. #pragma import on
  43. #endif
  44.  
  45. #if PRAGMA_ALIGN_SUPPORTED
  46. #pragma options align=mac68k
  47. #endif
  48.  
  49. #if defined(__MWERKS__) && GENERATING68K
  50.     #pragma push
  51.     #pragma pointers_in_D0
  52. #endif
  53.  
  54. #if FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
  55. /* old header = graphics macintosh */
  56.  
  57.  
  58. enum {
  59.     defaultPollingHandlerFlags    = 0x00,
  60.     okToSwitchDuringPollFlag    = 0x00,
  61.     dontSwitchDuringPollFlag    = 0x01
  62. };
  63.  
  64. typedef long gxPollingHandlerFlags;
  65. typedef void (*gxPollingHandlerProcPtr)(long reference, gxPollingHandlerFlags flags);
  66.  
  67. #if GENERATINGCFM
  68. typedef UniversalProcPtr gxPollingHandlerUPP;
  69. #else
  70. typedef gxPollingHandlerProcPtr gxPollingHandlerUPP;
  71. #endif
  72.  
  73. enum {
  74.     uppgxPollingHandlerProcInfo = kCStackBased
  75.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  76.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(gxPollingHandlerFlags)))
  77. };
  78.  
  79. #if GENERATINGCFM
  80. #define NewgxPollingHandlerProc(userRoutine)        \
  81.         (gxPollingHandlerUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxPollingHandlerProcInfo, GetCurrentArchitecture())
  82. #else
  83. #define NewgxPollingHandlerProc(userRoutine)        \
  84.         ((gxPollingHandlerUPP) (userRoutine))
  85. #endif
  86.  
  87. #if GENERATINGCFM
  88. #define CallgxPollingHandlerProc(userRoutine, reference, flags)        \
  89.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppgxPollingHandlerProcInfo, (reference), (flags))
  90. #else
  91. #define CallgxPollingHandlerProc(userRoutine, reference, flags)        \
  92.         (*(userRoutine))((reference), (flags))
  93. #endif
  94. extern gxPollingHandlerUPP GXGetGraphicsPollingHandler(long *reference)
  95.  THREEWORDINLINE(0x303C, 0x0245, 0xA832);
  96.  
  97. extern void GXSetGraphicsPollingHandler(gxPollingHandlerUPP handler, long reference)
  98.  THREEWORDINLINE(0x303C, 0x0246, 0xA832);
  99.  
  100. /* old header = graphics toolbox */
  101.  
  102. /* QD to QD GX Translator typedefs */
  103.  
  104. enum {
  105.     gxDefaultOptionsTranslation    = 0x0000,
  106.     gxOptimizedTranslation        = 0x0001,
  107.     gxReplaceLineWidthTranslation = 0x0002,
  108.     gxSimpleScalingTranslation    = 0x0004,
  109.     gxSimpleGeometryTranslation    = 0x0008,                        /* implies simple scaling */
  110.     gxSimpleLinesTranslation    = 0x000C,                        /* implies simple geometry & scaling */
  111.     gxLayoutTextTranslation        = 0x0010,                        /* turn on gxLine layout (normally off) */
  112.     gxRasterTargetTranslation    = 0x0020,
  113.     gxPostScriptTargetTranslation = 0x0040,
  114.     gxVectorTargetTranslation    = 0x0080,
  115.     gxPDDTargetTranslation        = 0x0100,
  116.     gxDontConvertPatternsTranslation = 0x1000
  117. };
  118.  
  119. typedef long gxTranslationOption;
  120.  
  121. enum {
  122.     gxContainsFormsBegin        = 0x0001,
  123.     gxContainsFormsEnd            = 0x0002,
  124.     gxContainsPostScript        = 0x0004,
  125.     gxContainsEmptyPostScript    = 0x0008
  126. };
  127.  
  128. typedef long gxTranslationStatistic;
  129.  
  130. enum {
  131.     gxQuickDrawPictTag            = 'pict'
  132. };
  133.  
  134. struct gxQuickDrawPict {
  135.                                                                 /* translator inputs */
  136.     gxTranslationOption             options;
  137.     Rect                             srcRect;
  138.     Point                             styleStretch;
  139.  
  140.                                                                 /* size of quickdraw picture data */
  141.     unsigned long                     dataLength;
  142.  
  143.                                                                 /* file alias */
  144.     gxBitmapDataSourceAlias         alias;
  145. };
  146. typedef struct gxQuickDrawPict gxQuickDrawPict;
  147.  
  148. /* WindowRecord utilities */
  149. extern gxViewPort GXNewWindowViewPort(WindowRef qdWindow)
  150.  THREEWORDINLINE(0x303C, 0x0236, 0xA832);
  151.  
  152. extern gxViewPort GXGetWindowViewPort(WindowRef qdWindow)
  153.  THREEWORDINLINE(0x303C, 0x0237, 0xA832);
  154.  
  155. extern WindowRef GXGetViewPortWindow(gxViewPort portOrder)
  156.  THREEWORDINLINE(0x303C, 0x0238, 0xA832);
  157.  
  158. /* GDevice utilities */
  159. extern GDHandle GXGetViewDeviceGDevice(gxViewDevice theDevice)
  160.  THREEWORDINLINE(0x303C, 0x0239, 0xA832);
  161.  
  162. extern gxViewDevice GXGetGDeviceViewDevice(GDHandle qdGDevice)
  163.  THREEWORDINLINE(0x303C, 0x023A, 0xA832);
  164.  
  165. /* gxPoint utilities */
  166. extern void GXConvertQDPoint(const Point *shortPt, gxViewPort portOrder, gxPoint *fixedPt)
  167.  THREEWORDINLINE(0x303C, 0x023B, 0xA832);
  168.  
  169. typedef OSErr (*gxShapeSpoolProcPtr)(gxShape toSpool, long refCon);
  170. /* printing utilities typedef */
  171. typedef void (*gxUserViewPortFilterProcPtr)(gxShape toFilter, gxViewPort portOrder, long refCon);
  172. typedef long (*gxConvertQDFontProcPtr)(gxStyle dst, long txFont, long txFace);
  173.  
  174. #if GENERATINGCFM
  175. typedef UniversalProcPtr gxShapeSpoolUPP;
  176. typedef UniversalProcPtr gxUserViewPortFilterUPP;
  177. typedef UniversalProcPtr gxConvertQDFontUPP;
  178. #else
  179. typedef gxShapeSpoolProcPtr gxShapeSpoolUPP;
  180. typedef gxUserViewPortFilterProcPtr gxUserViewPortFilterUPP;
  181. typedef gxConvertQDFontProcPtr gxConvertQDFontUPP;
  182. #endif
  183.  
  184. enum {
  185.     uppgxShapeSpoolProcInfo = kCStackBased
  186.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  187.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(gxShape)))
  188.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))),
  189.     uppgxUserViewPortFilterProcInfo = kCStackBased
  190.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(gxShape)))
  191.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(gxViewPort)))
  192.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long))),
  193.     uppgxConvertQDFontProcInfo = kCStackBased
  194.          | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  195.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(gxStyle)))
  196.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long)))
  197.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long)))
  198. };
  199.  
  200. #if GENERATINGCFM
  201. #define NewgxShapeSpoolProc(userRoutine)        \
  202.         (gxShapeSpoolUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxShapeSpoolProcInfo, GetCurrentArchitecture())
  203. #define NewgxUserViewPortFilterProc(userRoutine)        \
  204.         (gxUserViewPortFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxUserViewPortFilterProcInfo, GetCurrentArchitecture())
  205. #define NewgxConvertQDFontProc(userRoutine)        \
  206.         (gxConvertQDFontUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxConvertQDFontProcInfo, GetCurrentArchitecture())
  207. #else
  208. #define NewgxShapeSpoolProc(userRoutine)        \
  209.         ((gxShapeSpoolUPP) (userRoutine))
  210. #define NewgxUserViewPortFilterProc(userRoutine)        \
  211.         ((gxUserViewPortFilterUPP) (userRoutine))
  212. #define NewgxConvertQDFontProc(userRoutine)        \
  213.         ((gxConvertQDFontUPP) (userRoutine))
  214. #endif
  215.  
  216. #if GENERATINGCFM
  217. #define CallgxShapeSpoolProc(userRoutine, toSpool, refCon)        \
  218.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppgxShapeSpoolProcInfo, (toSpool), (refCon))
  219. #define CallgxUserViewPortFilterProc(userRoutine, toFilter, portOrder, refCon)        \
  220.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppgxUserViewPortFilterProcInfo, (toFilter), (portOrder), (refCon))
  221. #define CallgxConvertQDFontProc(userRoutine, dst, txFont, txFace)        \
  222.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppgxConvertQDFontProcInfo, (dst), (txFont), (txFace))
  223. #else
  224. #define CallgxShapeSpoolProc(userRoutine, toSpool, refCon)        \
  225.         (*(userRoutine))((toSpool), (refCon))
  226. #define CallgxUserViewPortFilterProc(userRoutine, toFilter, portOrder, refCon)        \
  227.         (*(userRoutine))((toFilter), (portOrder), (refCon))
  228. #define CallgxConvertQDFontProc(userRoutine, dst, txFont, txFace)        \
  229.         (*(userRoutine))((dst), (txFont), (txFace))
  230. #endif
  231. typedef gxShapeSpoolProcPtr gxShapeSpoolFunction;
  232. typedef gxUserViewPortFilterProcPtr gxUserViewPortFilter;
  233. typedef gxConvertQDFontProcPtr gxConvertQDFontFunction;
  234. /* mouse utilities */
  235. /* return mouse location in fixed-gxPoint global space */
  236. extern void GXGetGlobalMouse(gxPoint *globalPt)
  237.  THREEWORDINLINE(0x303C, 0x023C, 0xA832);
  238.  
  239. /* return fixed-gxPoint local mouse (gxViewPort == 0 --> default) */
  240. extern void GXGetViewPortMouse(gxViewPort portOrder, gxPoint *localPt)
  241.  THREEWORDINLINE(0x303C, 0x023D, 0xA832);
  242.  
  243. /* printing utilities */
  244. extern gxUserViewPortFilterUPP GXGetViewPortFilter(gxViewPort portOrder, long *refCon)
  245.  THREEWORDINLINE(0x303C, 0x025E, 0xA832);
  246.  
  247. extern void GXSetViewPortFilter(gxViewPort portOrder, gxUserViewPortFilterUPP filter, long refCon)
  248.  THREEWORDINLINE(0x303C, 0x023E, 0xA832);
  249.  
  250. /* QD to QD GX Translator functions */
  251. extern void GXInstallQDTranslator(GrafPtr port, gxTranslationOption options, const Rect *srcRect, const Rect *dstRect, Point styleStrech, gxShapeSpoolUPP userFunction, void *reference)
  252.  THREEWORDINLINE(0x303C, 0x023F, 0xA832);
  253.  
  254. extern gxTranslationStatistic GXRemoveQDTranslator(GrafPtr port, gxTranslationStatistic *statistic)
  255.  THREEWORDINLINE(0x303C, 0x0240, 0xA832);
  256.  
  257. extern gxShape GXConvertPICTToShape(PicHandle pict, gxTranslationOption options, const Rect *srcRect, const Rect *dstRect, Point styleStretch, gxShape destination, gxTranslationStatistic *stats)
  258.  THREEWORDINLINE(0x303C, 0x0241, 0xA832);
  259.  
  260. /* Find the best GX style given a QD font and face. Called by the QD->GX translator */
  261. extern long GXConvertQDFont(gxStyle theStyle, long txFont, long txFace)
  262.  THREEWORDINLINE(0x303C, 0x0242, 0xA832);
  263.  
  264. extern gxConvertQDFontUPP GXGetConvertQDFont(void )
  265.  THREEWORDINLINE(0x303C, 0x0243, 0xA832);
  266.  
  267. extern void GXSetConvertQDFont(gxConvertQDFontUPP userFunction)
  268.  THREEWORDINLINE(0x303C, 0x0244, 0xA832);
  269.  
  270. /* ColorSync 2.0 interface related routines */
  271. extern void GXSetColorProfileReference(gxColorProfile profile, CMProfileRef reference)
  272.  THREEWORDINLINE(0x303C, 0x0282, 0xA832);
  273.  
  274. extern CMProfileRef GXGetColorProfileReference(gxColorProfile profile)
  275.  THREEWORDINLINE(0x303C, 0x0283, 0xA832);
  276.  
  277. #endif
  278.  
  279. #if defined(__MWERKS__) && GENERATING68K
  280.     #pragma pop
  281. #endif
  282.  
  283. #if PRAGMA_ALIGN_SUPPORTED
  284. #pragma options align=reset
  285. #endif
  286.  
  287. #if PRAGMA_IMPORT_SUPPORTED
  288. #pragma import off
  289. #endif
  290.  
  291. #ifdef __cplusplus
  292. }
  293. #endif
  294.  
  295. #endif /* __GXENVIRONMENT__ */
  296.  
  297.